package com.yihuan.service;

import com.yihuan.entity.OrderEntity;
import com.yihuan.mapper.OrderMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Author:梦醒
 * Date: 2022/4/24 17:58
 * Dream:
 * 信言不美，美言不信。
 * 善者不辩，辩者不善。
 * 知者不博，博者不知。
 * Function:
 */
@Service
public class OrderService {
    @Resource
    OrderMapper orderMapper;
    
    /**
     * 注册订单信息
     *
     * @param orderProductEntity
     * @return
     */
    public int insertOrderByOrderData(OrderEntity orderProductEntity) {
        return orderMapper.insertOrderByOrderData(orderProductEntity);
    }
    
    /**
     * 更改订单状态
     *
     * @param orderProductEntity
     * @return
     */
    public int updateOrderByOrderState(OrderEntity orderProductEntity) {
        return orderMapper.updateOrderByOrderState(orderProductEntity);
    }
    
    /**
     * 查询订单编号
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderByOrderAndOrderDate(OrderEntity orderEntity) {
        return orderMapper.findOrderByOrderAndOrderDate(orderEntity);
    }
    
    /**
     * 查询对应公司的订单信息
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderByOrderUsersData(OrderEntity orderEntity) {
        return orderMapper.findOrderByOrderUsersData(orderEntity);
    }
    
    /**
     * 更改订单信息
     *
     * @param orderEntity
     * @return
     */
    public int updateOrderByUsersID(OrderEntity orderEntity) {
        return orderMapper.updateOrderByUsersID(orderEntity);
    }
    
    /**
     * 已结单 未输入数据
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderByOrderStateData(OrderEntity orderEntity) {
        return orderMapper.findOrderByOrderStateData(orderEntity);
    }
    
    /**
     * 输入总价
     *
     * @param orderEntity
     * @return
     */
    public int updateOrderByOrderPrice(OrderEntity orderEntity) {
        return orderMapper.updateOrderByOrderPrice(orderEntity);
    }
    
    /**
     * 查询不同状态下的订单
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderByOrderData(OrderEntity orderEntity) {
        return orderMapper.findOrderByOrderData(orderEntity);
    }
    
    /**
     * 分页查询
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderByOrderList(OrderEntity orderEntity) {
        return orderMapper.findOrderByOrderList(orderEntity);
    }
    
    /**
     * 统计分页查询数据
     *
     * @param orderEntity
     * @return
     */
    public int countOrderList(OrderEntity orderEntity) {
        return orderMapper.countOrderList(orderEntity);
    }
    
    /**
     * 成交金额
     *
     * @param orderEntity
     * @return
     */
    public double sumOrderListByCompID(OrderEntity orderEntity) {
        return orderMapper.sumOrderListByCompID(orderEntity);
    }
    
    /**
     * 总体成交金额
     *
     * @param orderEntity
     * @return
     */
    public double sumOrderList(OrderEntity orderEntity) {
        return orderMapper.sumOrderListByCompID(orderEntity);
    }
    
    /**
     * 统计订单数量
     *
     * @param orderEntity
     * @return
     */
    public int sumOrderListByCompIDAndOrderState(OrderEntity orderEntity) {
        return orderMapper.sumOrderListByCompIDAndOrderState(orderEntity);
    }
    
    /**
     * 统计订单数量
     *
     * @param orderEntity
     * @return
     */
    public int sumOrderListAndOrderState(OrderEntity orderEntity) {
        return orderMapper.sumOrderListAndOrderState(orderEntity);
    }
    
    /**
     * 查询订单对应的数据
     *
     * @param orderEntity
     * @return
     */
    public List<OrderEntity> findOrderPriceByOrderPrice(OrderEntity orderEntity) {
        return orderMapper.findOrderPriceByOrderPrice(orderEntity);
    }
}
